#define GTK_COMPOSE_TABLE_MAGIC "GtkComposeTable"
#define GTK_COMPOSE_TABLE_VERSION (1)
+/* Maximum length of sequences we parse */
+
+#define MAX_COMPOSE_LEN 20
+
typedef struct {
gunichar *sequence;
gunichar value[2];
}
g_strfreev (words);
- if (0 == n || n > GTK_MAX_COMPOSE_LEN)
+ if (0 == n || n > MAX_COMPOSE_LEN)
{
- g_warning ("The max length of compose sequences is %d: %s",
- GTK_MAX_COMPOSE_LEN, line);
+ g_warning ("Suspicious compose sequence length (%d). Are you sure this is right?: %s",
+ n, line);
return FALSE;
}
for (list = compose_list; list != NULL; list = list->next)
{
- static guint16 keysyms[GTK_MAX_COMPOSE_LEN + 1];
+ static guint16 keysyms[MAX_COMPOSE_LEN + 1];
int i;
int n_compose = 0;
gboolean compose_finish;
compose_data = list->data;
- for (i = 0; i < GTK_MAX_COMPOSE_LEN + 1; i++)
+ for (i = 0; i < MAX_COMPOSE_LEN + 1; i++)
keysyms[i] = 0;
- for (i = 0; i < GTK_MAX_COMPOSE_LEN + 1; i++)
+ for (i = 0; i < MAX_COMPOSE_LEN + 1; i++)
{
gunichar codepoint = compose_data->sequence[i];
keysyms[i] = (guint16) codepoint;
int i;
compose_data = list->data;
- for (i = 0; i < GTK_MAX_COMPOSE_LEN; i++)
+ for (i = 0; i < MAX_COMPOSE_LEN; i++)
{
gunichar codepoint = compose_data->sequence[i];
for (list = compose_list; list != NULL; list = list->next)
{
compose_data = list->data;
- for (i = 0; i < GTK_MAX_COMPOSE_LEN + 1; i++)
+ for (i = 0; i < MAX_COMPOSE_LEN + 1; i++)
{
codepoint = compose_data->sequence[i];
if (codepoint == 0)
guint16 *gtk_compose_seqs = NULL;
g_return_val_if_fail (data != NULL, compose_tables);
- g_return_val_if_fail (max_seq_len <= GTK_MAX_COMPOSE_LEN, compose_tables);
+ g_return_val_if_fail (max_seq_len >= 0, compose_tables);
+ g_return_val_if_fail (n_seqs >= 0, compose_tables);
- n_index_stride = MIN (max_seq_len, GTK_MAX_COMPOSE_LEN) + 2;
+ n_index_stride = max_seq_len + 2;
if (!g_size_checked_mul (&length, n_index_stride, n_seqs))
{
g_critical ("Overflow in the compose sequences");
}
GSList *
-gtk_compose_table_list_add_file (GSList *compose_tables,
+gtk_compose_table_list_add_file (GSList *compose_tables,
const char *compose_file)
{
guint32 hash;